import asyncio
import aioredis
from fastapi import FastAPI

from core.mysql import engine
from models.base import Base


def register_redis(app: FastAPI) -> None:
    """
    把redis挂载到app对象上面
    :param app:
    :return:
    """
    @app.on_event('startup')
    def startup():
        # 创建数据库表
        Base.metadata.create_all(bind=engine)

